﻿@using System.Web.Mvc
@using Microsoft.AspNet.Identity
@using Whoever.Framework.Enum

@helper Script(string scriptName, UrlHelper url)
{
    <script type="text/javascript" src="@url.Content(string.Format("~/Resources/Scripts/{0}", scriptName))"></script>
}
@helper Css(string cssName, UrlHelper url)
{
    <link href="@url.Content(string.Format("~/Resources/Styles/{0}", cssName))" rel="stylesheet" type="text/css" />
}
@helper ViewModel(string viewModelName, UrlHelper url)
{
    <script type="text/javascript" src="@url.Content(string.Format("~/Resources/Scripts/ViewModels/{0}", viewModelName))"></script>
}

@helper ViewModelCore(string viewModelCoreName, UrlHelper url)
{
    <script type="text/javascript" src="@url.Content(string.Format("~/Resources/Scripts/ViewModels/Core/{0}", viewModelCoreName))"></script>
}

@helper ViewModelBase(string viewModelBaseName, UrlHelper url)
{
    <script type="text/javascript" src="@url.Content(string.Format("~/Resources/Scripts/ViewModels/Base/{0}", viewModelBaseName))"></script>
}

@helper MainViewModel(UrlHelper url)
{
    @ViewModelCore("Page.js", url)
    @ViewModelCore("CRUD.js", url)
    @ViewModelCore("Validation.js", url)
    @ViewModelCore("Component.js", url)
    @ViewModel("Main.js", url)
}

@helper Module(string moduleName, UrlHelper url)
{
    <script type="text/javascript" src="@url.Content(string.Format("~/Resources/Scripts/Modules/{0}", moduleName))"></script>
}

@helper Resource(string folder, string resourceName, UrlHelper url)
{
    <script type="text/javascript" src="@url.Content(string.Format("~/Resources/{0}/{1}", folder, resourceName))"></script>
}

@helper GlobalVar(System.Web.Mvc.HtmlHelper<dynamic> htmlHelper)
{
    <text>
        var invalidModelMessage = '@htmlHelper.LocalizedMessage("Model", MessageType.Error)';
        var formErrorMessage = '@htmlHelper.LocalizedMessage("Form", MessageType.Error)';
        var errorMessage = '@htmlHelper.LocalizedMessage("Exception", MessageType.Error)';
        var adviceText = '@htmlHelper.LocalizedText("Advice")';
    </text>
}
